//
//  EXT-UIButton.swift
//  SSSina
//
//  Created by ss on 2017/6/29.
//  Copyright © 2017年 ss. All rights reserved.
//

import UIKit

extension UIButton {
    //  设置按钮的文字,和背景颜色
    convenience init(title: String?,fontSize: CGFloat,normalColor:UIColor,highlightedColor:UIColor,backgroundImage: String,target: Any?,action: Selector){
        
        self.init()
        self.addTarget(target, action: action, for: UIControlEvents.touchUpInside)
        self.setTitle(title, for: UIControlState.normal)
        self.setTitleColor(normalColor, for: UIControlState.normal)
        self.setTitleColor(highlightedColor, for: UIControlState.highlighted)
        self.titleLabel?.font = UIFont.systemFont(ofSize: fontSize)
        self.setBackgroundImage(UIImage.resizableImage(named: backgroundImage), for: UIControlState.normal)
    }
    
}
